/* Yet Another Experimental Software Renderer
 *
 * Copyright (c) 2010 Pawel "Hery" Dziepak
 */

#ifndef TOKENIZER_H_
#define TOKENIZER_H_

#include "char_reader.h"

namespace yasl {
	class tokenizer {
	public:
		enum token_type {
			token_unknown,
			token_data_semantics,
			token_data_type,
			token_keyword,
			token_number,
			token_name,
			token_operator,
			token_symbol
		};

		tokenizer(char_reader *cr) : reader(cr) { }

		token_type get_type() const;
		const std::string &get_string() const;
		bool next();

		static const char *data_types[];
		static const char *data_semantics[];
		static const char *keywords[];
		static const char *operators[];

		static bool is_in(char, const char *, int);
		static bool is_one_of(const char *, const char **, int);
		static int find_in(const char*, const char **, int);
	private:
		char_reader *reader;

		std::string buffer;

		static const char whitespaces[];
		static const char operator_chars[];
	};
}

#endif